-
-
Notifications
You must be signed in to change notification settings - Fork 102
[Agent] Add Platform tool wrapper for using platforms as tools #722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[Agent] Add Platform tool wrapper for using platforms as tools #722
Conversation
Any idea @chr-hertel ? ![]() |
maybe the options argument? not sure |
No, even removing the options does not help |
Best would be Xdedump i guess |
return $this->platform->invoke( | ||
$this->model, | ||
$message, | ||
$this->options, | ||
)->asText(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check for instanceof TextResult and handle other cases. at least ObjectResult can be json serialized
$count = 0; | ||
if (!empty($v['agent'])) { | ||
++$count; | ||
} | ||
if (!empty($v['service'])) { | ||
++$count; | ||
} | ||
if (!empty($v['platform'])) { | ||
++$count; | ||
} | ||
|
||
return 1 !== $count; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha nice, that's pragmatic 👍
->stringNode('model')->cannotBeEmpty()->end() | ||
->arrayNode('options') | ||
->info('Options to pass to the platform') | ||
->scalarPrototype()->end() | ||
->end() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we validate that model
and options
is only allowed in combination with platform
? or do i get it wrong?
Introduces a new Platform tool that wraps any PlatformInterface instance, allowing agents to use specialized platforms as tools. This enables scenarios like an OpenAI agent using ElevenLabs for speech-to-text. - Add Platform tool class with support for Text, Audio, and Image results - Add OpenAI example demonstrating ElevenLabs platform as tool - Add documentation explaining the concept and usage - Update demo AI Bundle configuration with platform tool examples
Platforms can now be configured as tools in agent definitions: ai: agent: my_agent: tools: - platform: 'elevenlabs' model: 'scribe_v1' name: 'transcribe_audio' description: 'Transcribes audio files to text' options: [] This allows agents to use specialized platforms as tools, enabling scenarios like an OpenAI agent using ElevenLabs for speech-to-text.
Removed explicit await() and result type matching by using the ResultPromise::asText() convenience method which handles the await internally and extracts text content directly.
Updated platform-as-tool.php to follow the same pattern as agent-as-tool.php: - Use MemoryToolFactory to register tool with name and description - Use ChainFactory to combine MemoryToolFactory and ReflectionToolFactory - Provides better tool metadata for the agent
Changed from ElevenLabs speech-to-text example to a simpler OpenAI-only example that mirrors the agent-as-tool pattern: - Main agent uses gpt-4o-mini - Platform tool uses gpt-4o for advanced analysis - Demonstrates using a more powerful model as a tool for complex tasks - Removes external dependency on ElevenLabs API key
Changed from complex philosophical question to the same simple math question used in agent-as-tool.php for consistency and clarity.
- Removed ElevenLabs reference from docblock example - Updated example to use gpt-4o/gpt-4o-mini scenario - Fixed parameter name from $message to $input to match signature
ec5c747
to
ee38c77
Compare
Uh oh!
There was an error while loading. Please reload this page.